<?php

if (isset($_REQUEST["height"])) {
$height=   $_REQUEST["height"];
$bredde=   $_REQUEST["bredde"];
$type=	   $_REQUEST["type"];
	
	echo "h: $height w: $bredde type: $type";
	
if ($type=="areal") { $res=$bredde*$height;

	} else {
	$res=2*$height+2*$bredde;
	}
echo $res;	
	}

?>

<form action="firkantbregner.php">
	Height: <input type="text" name="height" /> <BR />
    Bredde: <input type="text" name="bredde" /> <br />
    <input type="radio" checked="checked" name="type" value="omkreds" /> Omkreds <BR />
    <input type="radio" name="type" value="areal" /> Areal <BR />
    <input type="submit" />
</form>    